#include<iostream>
using namespace std;
int main()
{
	int a[100][100] = { 0 };
	int n;
	cin >> n;
	int i = 0;
	int j = 0;
	int count = 1;
	int n1 = n * n;
	for (i=1; i <= n; i++)
	{
		count = count + i-1;
		int ct = count;

 		if (i % 2 == 1)
		{
			int j = 1;
			int k = i;
			while (j <= n && k >= 1)
			{
				a[k][j] = ct;
				ct++;
				j++;
				k--;
			}
		}
		else
		{
			int j = i;
			int k = 1;
			

			while(k<=n&&j>=1)
			{
					a[k][j] = ct;
					ct++;
					k++;
					j--;
			}
		} 
	}
	count = count + i-1 ;
	if (n % 2 == 1)
	{
		for (i = 1; i <= n; i++)
		{
			if (i == 1)
				continue;

			int ct = count;

			if (i % 2 == 1)
			{
				int j = i;
				int k = n;


				while (k >= 1 && j <= n)
				{
					a[k][j] = ct;
					ct++;
					k--;
					j++;
				}

			}
			else
			{
				int j = n;
				int k = i;
				while (j >= 1 && k <= n)
				{
					a[k][j] = ct;
					ct++;
					j--;
					k++;
				}
			}
			count = count + n - i + 1;

		}
	}
	else
	{
		for (i = 1; i <= n; i++)
		{
			if (i == 1)
				continue;

			int ct = count;

			if (i % 2 == 0)
			{
				int j = i;
				int k = n;


				while (k >= 1 && j <= n)
				{
					a[k][j] = ct;
					ct++;
					k--;
					j++;
				}

			}
			else
			{
				int j = n;
				int k = i;
				while (j >= 1 && k <= n)
				{
					a[k][j] = ct;
					ct++;
					j--;
					k++;
				}
			}
			count = count + n - i + 1;

		}
	}
	for (i = 1; i <= n; i++)
	{
		int j;
		for (j = 1; j <= n; j++)
			printf("%d ", a[i][j]);
		printf("\n");
	}
}